package com.google.code.mochaccino.framework.rest.mime;
/*
 * Copyright 2012 Claude Houle claude.houle@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/** A simple class defining the mime-type */
public final class MimeType {
	/** Extension */
	private String extension;

	/** Mime Type */
	private String mimeType;

	/** Constructor */
	public MimeType( String extension, String mimeType ) {
		this.extension = extension;
		this.mimeType = mimeType;
	}

	@Override
	public boolean equals( Object o ) {
		if ( this == o ) {
			return true;
		}
		if ( o == null || getClass() != o.getClass() ) {
			return false;
		}

		MimeType mimeType1 = (MimeType) o;

		if ( extension != null ? !extension.equals( mimeType1.extension ) : mimeType1.extension != null ) {
			return false;
		}
		if ( mimeType != null ? !mimeType.equals( mimeType1.mimeType ) : mimeType1.mimeType != null ) {
			return false;
		}

		return true;
	}

	/** return the extension */
	public String getExtension() {
		return extension;
	}

	/** return the mime-type */
	public String getMimeType() {
		return mimeType;
	}

	@Override
	public int hashCode() {
		int result = extension != null ? extension.hashCode() : 0;
		result = 31 * result + (mimeType != null ? mimeType.hashCode() : 0);
		return result;
	}
}
